package com.supreme.scheduleserver.controller;

import com.supreme.commonboot.exception.BizException;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping(value = "sentinel")
public class SentinelController {

    @GetMapping(value = "test")
    public String sentinelTest() {
        return "sentinel test";
    }

    @GetMapping(value = "fuse")
    public String sentinelFuse() {
        return "sentinel fuse";
    }

    @GetMapping(value = "exception")
    public String sentinelFuse(@RequestParam(value = "data") Integer data) {
        if (data < 0) {
            throw new BizException("我靠，我又错了。");
        }
        return "sentinel exception";
    }
}
